﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/admin/Views/Shared/List.Master"
    Inherits="System.Web.Mvc.ViewPage<Longtop.Web.SaleWeb.Admin.Sales.ListModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <thead>
        <tr>
            <th>
                帐户
            </th>
            <th>
                真名
            </th>
            <th>
                部门
            </th>
            <th>
                角色
            </th>
            <th>
                入职时间
            </th>
            <th>
                锁定状态
            </th>
            <th>
                操作
            </th>
        </tr>
    </thead>
    <tbody>
        <% foreach (var item in Model.PagedList) {
               var index = Model.PagedList.IndexOf(item);
        %>
        <tr>
            <td>
                <label>
                    <%=Html.CheckBox("UserName",false) %>
                    <%=Html.HiddenFor(m=>m.PagedList[index].UserName) %>
                    <%= Html.Encode(item.UserName) %></label>
            </td>
            <td>
                <%=item.NickName %>
            </td>
            <td>
                <%foreach (var d in item.Departments) {
                %>
                <%=d.Text+(item.Departments.IndexOf(d) == (item.Departments.Count - 1) ? "" : ",")%>
                <%
                    } %>
            </td>
            <td>
                <%foreach (var r in item.Roles) {
                %>
                <%=r.Rolename +(item.Roles.IndexOf(r)==(item.Roles.Count-1)?"":",") %>
                <%
                    } %>
            </td>
            <td>
                <%= string.Format("{0:yyyy/MM/dd}", item.JoinDate)%>
            </td>
            <td>
                <%= item.isLocked?"已锁定":"正常" %>
            </td>
            <td>
                <%= Html.ActionLink("编辑", "edit", new {  id=item.UserName}) %>
                |
                <%= Html.ActionLink("设定部门", "setdepartments", new { id = item.UserName })%>
                |
                <%= Html.ActionLink("设定角色", "setroles", new { id = item.UserName })%>
                |
                <%= Html.ActionLink(item.isLocked?"解锁":"锁定", "lock", new { id = item.UserName })%>
            </td>
        </tr>
        <% } %>
    </tbody>
</asp:Content>
<asp:Content ID="Pager" ContentPlaceHolderID="Pager" runat="server">
    <%=Html.Pager(Model) %>
</asp:Content>
